/**
 * Syg at 14.03.2013 for Pikovskii
 */
package intf.impl;

import java.util.ArrayList;

import geometry.IXYPolyline;
import intf.ILevel;
import intf.ILine;
import intf.IPLine;

/**
 * @author Syg
 *
 */
public final class LevelImpl implements ILevel
{

	private int m_index;
	private String m_name;
	private double m_N;
	private ArrayList<ILine> m_lines;
	//private PLineImpl m_pline;

	/**
	 * @param levelIndex int with level index. Must be unique
	 * @param name Mandatory name of the level
	 * @param N double parameter for conversion
	 */
    public LevelImpl( int levelIndex, String name, double N)
    {
	    this.m_index = levelIndex;
	    this.m_name = name;
	    this.m_N = N;
	    m_lines = new ArrayList<ILine>();
//	    m_pline = new PLineImpl();
    }

	/**
	 * @param n the m_N to set
	 */
	public void setN( double n )
	{
		this.m_N = n;
	}

	/**
	 * @param name the m_name to set
	 */
	public void setName( String name )
	{
		this.m_name = name;
	}

	/* (non-Javadoc)
	 * @see intf.ILevel#index()
	 */
    @Override
    public int index()
    {
        return m_index;
    }

	/* (non-Javadoc)
	 * @see intf.ILevel#name()
	 */
    @Override
    public String name()
    {
        return m_name;
    }

	/* (non-Javadoc)
	 * @see intf.ILevel#N()
	 */
    @Override
    public double N()
    {
        return m_N;
    }
    
	/* (non-Javadoc)
	 * @see intf.ILevel#plineCount()
	 */
    @Override
    public int lineCount()
    {
        return m_lines.size();
    }

	/* (non-Javadoc)
	 * @see intf.ILevel#pline(int)
	 */
    @Override
    public ILine line( int index )
    {
    	return m_lines.get(index);
    }
    
    public void addLine(double x1, double y1, double x2, double y2)
    {
    	m_lines.add( new LineImpl(x1, y1, x2, y2));
    }

}